Extend VCPUINFO dom0_op to return status information about
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sat, 15 Oct 2005 07:52:22 +0000 (08:52 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Sat, 15 Oct 2005 07:52:22 +0000 (08:52 +0100)
run state of the VCPU. VCPUCONTEXT returns info about
hotplugged VCPUs.
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/dom0_ops.c
xen/include/public/dom0_ops.h

index 9541adbbf8833a65a8a4434b1e6ffbdde6175c7c..5d1f17adc7308b096d52550b66f56f6729a5fcab 100644 (file)
@@ -447,7 +447,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
 
         ret = -ESRCH;
         v = d->vcpu[op->u.getvcpucontext.vcpu];
-        if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) )
+        if ( (v == NULL) || !test_bit(_VCPUF_initialised, &v->vcpu_flags) )
             goto getvcpucontext_out;
 
         ret = -ENOMEM;
@@ -490,10 +490,12 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
             goto getvcpuinfo_out;
 
         ret = -ESRCH;
-        v = d->vcpu[op->u.getvcpuinfo.vcpu];
-        if ( (v == NULL) || test_bit(_VCPUF_down, &v->vcpu_flags) )
+        if ( (v = d->vcpu[op->u.getvcpuinfo.vcpu]) == NULL )
             goto getvcpuinfo_out;
 
+        op->u.getvcpuinfo.online   = !test_bit(_VCPUF_down, &v->vcpu_flags);
+        op->u.getvcpuinfo.blocked  = test_bit(_VCPUF_blocked, &v->vcpu_flags);
+        op->u.getvcpuinfo.running  = test_bit(_VCPUF_running, &v->vcpu_flags);
         op->u.getvcpuinfo.cpu_time = v->cpu_time;
         op->u.getvcpuinfo.cpu      = v->processor;
         op->u.getvcpuinfo.cpumap   = v->cpumap;
index 9402feb30eba0559bf1ac88c1eb71fd6e22b2fb1..9556d43f57cb4a7e06f4807cab39e631365c514d 100644 (file)
@@ -365,7 +365,10 @@ typedef struct {
     domid_t  domain;                  /* domain to be affected */
     uint16_t vcpu;                    /* vcpu # */
     /* OUT variables. */
-    uint64_t cpu_time;                 
+    uint8_t  online;                  /* currently online (not hotplugged)? */
+    uint8_t  blocked;                 /* blocked waiting for an event? */
+    uint8_t  running;                 /* currently scheduled on its CPU? */
+    uint64_t cpu_time;                /* total cpu time consumed (ns) */
     uint32_t cpu;                     /* current mapping   */
     cpumap_t cpumap;                  /* allowable mapping */
 } dom0_getvcpuinfo_t;